home *** CD-ROM | disk | FTP | other *** search
- > Here's a little trick I found the other day, hope somebody can use it..
- > To store an integer-array you would normaly open a sequentiel file
- > and dump the data with a loop.. Well try this instead:
- > MX=50
- > Dim A(MX)
- > Bsave FILE$,Varptr(A(0)) To Varptr(A(0))+(MX+1)*4
- > And to reload:
- > Bload FILE$,Varptr(A(0))
- > You can simply replace Bsave with Ssave if you'd like to have more
- > than one Array in a file. Or use Copy to put in a bank :)
-
- Yes, this is very efficient and is the method I used in my SideShooter
- stage for loading the arrays with file-data. MUCH faster than the
- standard "loop and load" approach and just all-round more
- efficient, so I'd recommend using this as well... besides, once you're
- used to seeing everything as binary-data (which everything is in
- the end), you can move between languages like AMOS, C,
- Assembler, etc. much easier. :-)
-
- Another thing to consider is writing a small array-to-binary
- convertor as many times you don't need 32-bit (long word) values.
- For example, I ran the scrolling-map (used in the SideShooter)
- through a simple convertor I threw together which saved out an
- 8-bit binary data file, resulting in the map file size decreasing to
- just 25% of it's original size and loading MUCH faster as well. ;-)
-
-
- Garfield Benjamin e-mail:gbenjam@sosbbs.com
- Website( http://www.sosbbs.com/~gbenjam ): 50% Complete
-
-